package main

import "fmt"

func testSlice()  {
	var slice []int
	var arr  = [...]int{1,2,3,4,5}

	fmt.Println(len(arr))
	slice = arr[0:]
	slice = arr[:]
	fmt.Println(slice)
	fmt.Println(len(slice))
	fmt.Println(cap(slice))

	slice = slice[0:1]
	fmt.Println(len(slice))
	fmt.Println(cap(slice))
}

func modify(a []int)  {
	a[1] = 1000
}

func testSlice2()  {
	var b  = []int{1,2,3,4}
	fmt.Println(b)
	modify(b)
	fmt.Println(b)
}

func testSlice3()  {
	var a = [10]int{1,2,3,4}

	b:= a[1:5]
	fmt.Printf("%p\n",b)
	fmt.Printf("%p\n",&a[1])
}

func main()  {
	//testSlice()
	testSlice2()
	testSlice3()
}
